home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDCOMMUL.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  6.0 KB  |  148 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdcommul.rul                                              */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdComponentMult       */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdComponentMult                                            */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will let user choose different parts of the    */
  22.  /*             software to install based on the components and sub        */
  23.  /*             components.                                                */
  24.  /*   Misc:                                                                */
  25.  /*                                                                        */
  26.  /*------------------------------------------------------------------------*/
  27. function SdComponentMult( szTitle, szMsg, szTargetDir, szComponents )
  28.           STRING  szDlg, szTemp;
  29.           HWND    hwndDlg, hwndListBox;
  30.           NUMBER  nParentView, nChildView;
  31.           NUMBER  nId, nTemp;
  32.           BOOL    bDone;
  33.         begin
  34.  
  35.            szDlg     = SD_DLG_COMPONENTMULT;
  36.            nSdDialog = SD_NDLG_COMPONENTMULT;
  37.  
  38.            // record data produced by this dialog
  39.            if (MODE=SILENTMODE) then
  40.              SdMakeName( szAppKey, szDlg, szTitle, nSdComponentMult );
  41.              SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  42.              if ((nId != BACK) && (nId != CANCEL)) then
  43.                 SilentReadData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  44.              endif;
  45.  
  46.              return nId;
  47.            endif;
  48.  
  49.            // ensure general initialization is complete
  50.            if (!bSdInit) then
  51.               SdInit();
  52.            endif;
  53.  
  54.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_COMPONENTMULT ) = DLG_ERR) then
  55.               return -1;
  56.            endif;
  57.  
  58.  
  59.            // Loop in dialog until the user selects a standard button
  60.            bDone = FALSE;
  61.  
  62.            while (!bDone)
  63.  
  64.               nId = WaitOnDialog( szDlg );
  65.  
  66.               switch (nId)
  67.               case DLG_INIT:
  68.  
  69.                    if( szMsg != "" ) then
  70.                        SdSetStatic( szDlg, SD_COMPONENT_MSG, szMsg );
  71.                    endif;
  72.  
  73.                    hwndDlg = CmdGetHwndDlg( szDlg );
  74.                    SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
  75.  
  76.                    if(szTitle != "") then
  77.                        SetWindowText(hwndDlg, szTitle);
  78.                    endif;
  79.  
  80.                    nParentView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, szTargetDir );
  81.                    if (!nParentView) then
  82.                        SdError( -1, "SdComponentDialogAdv" );
  83.                        nId = -1;
  84.                        bDone = TRUE;
  85.                    endif;
  86.  
  87.                    nChildView = SdCreateComponentView( hwndDlg, SD_LISTBOX2, szComponents, szTargetDir );
  88.                    if (!nChildView) then
  89.                        SdError( -1, "SdComponentDialogAdv" );
  90.                        nId = -1;
  91.                        bDone = TRUE;
  92.                    endif;
  93.                    
  94.                    ComponentViewSetInfo( nParentView, COMPONENT_VIEW_CHILDVIEW, nChildView, "");
  95.                    ComponentViewSetInfo( nChildView, COMPONENT_VIEW_PARENTVIEW, nParentView, "");
  96.  
  97.                    ComponentViewRefresh( nParentView, 0);
  98.  
  99.                    hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
  100.                    SetFocus( hwndListBox );
  101.  
  102.  
  103.               case SD_PBUT_OK:
  104.                    if( StrCompare(szTargetDir, "") && !SdComponentDlgCheckSpace( szComponents, szDlg, szTargetDir ) ) then
  105.                       MessageBox( szSdStr_NotEnoughSpace, WARNING );
  106.                    else
  107.                       nId   = OK;
  108.                       bDone = TRUE;
  109.                    endif;
  110.  
  111.               case BACK:
  112.                    nId    = BACK;
  113.                    bDone  = TRUE;
  114.  
  115.               case DLG_ERR:
  116.                    SdError( -1, "SdComponentMult" );
  117.                    nId   = -1;
  118.                    bDone = TRUE;
  119.  
  120.               case DLG_CLOSE:
  121.                    SdCloseDlg( hwndDlg, nId, bDone );
  122.  
  123.               default:
  124.                    // check standard handling
  125.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  126.                        bDone = TRUE;
  127.                    endif;
  128.               endswitch;
  129.  
  130.            endwhile;
  131.  
  132.            EndDialog( szDlg );
  133.            ReleaseDialog( szDlg );
  134.            ComponentViewDestroy( nChildView );
  135.            ComponentViewDestroy( nParentView );
  136.  
  137.            SdUnInit( );
  138.  
  139.            // record data produced by this dialog
  140.            SdMakeName( szAppKey, szDlg, szTitle, nSdComponentMult );
  141.            SilentWriteData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  142.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  143.  
  144.            return nId;
  145.  
  146.         end;
  147.  
  148.